//冒泡排序
void BubbleSort(int* a, int n)
{
    int tmp = 0;
	for (int i = 0; i < n; i++)
	{
		int exchange = 0;
		for (int j = 1; j < n - i; j++)
		{
			if (a[j + 1] > a[j])
			{
                tmp = a[j+1];
                a[j+1] = a[j];
                a[j] = tmp;
				exchange = 1;
			}
		}

		if (exchange == 0)
		{
			break;
		}
	}
}
//快速排序
void QuickSort(int* a, int l, int r)
{
	if (l < r)
	{
		int begin = l;
		int tmp = a[begin];
		int end = r;
		int tmp = a[begin];
		while (begin < end)
		{
			while (begin < end && a[end] >= tmp)
			{
				end--;
			}
			if (begin < end)
			{
				a[begin++] = a[end];
			}
			while (begin < end && a[begin] < tmp)
			{
				begin++;
			}
			if (begin < end)
			{
				a[end--] = a[begin];
			}
		}
		a[begin] = tmp;
		QuickSort(a,l, begin - 1);
		QuickSort(a,begin + 1, r);
	}
}
